include Makefile.common

CVSROOT=:ext:ievlev@cvs.sourceforge.net:/cvsroot/ndk-xx

INDENT_FILES=$(shell find . -name '*.cc' -o -name '*.hh')

.PHONY: all clean indent

SUBDIRS = src examples

all:
	@for i in $(SUBDIRS); do $(MAKE) -C $$i all || exit 1; done

clean:
	@for i in $(SUBDIRS); do $(MAKE) -C $$i clean || exit 1; done

install: all
	@for i in $(SUBDIRS); do $(MAKE) -C $$i install || exit 1; done

indent:
	@(for i in $(INDENT_FILES) ;do \
	astyle --mode=c++ --style=ansi -N -T8 -Oo --pad=oper $$i;\
	done)
	@find . -type f -name '*.orig' -print0 | xargs -r0 rm -f

distrib:
	@cvs commit -m ' - Auto commit'
	@mkdir -p $(NAME)-$(VERSION)
	@CVSROOT=$(CVSROOT) cvs co $(NAME)
	@mv $(NAME)/* $(NAME)-$(VERSION)
	@./cvs2cl.pl -b --fsf -f $(NAME)-$(VERSION)/ChangeLog
	@rmdir $(NAME)
	@find $(NAME)-$(VERSION) -type d -name 'CVS'|xargs rm -rf
	@tar -cjpf $(NAME)-$(VERSION).tar.bz2 $(NAME)-$(VERSION)
	@rm -rf $(NAME)-$(VERSION)
